<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %> 
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %> 
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="renderer" content="webkit">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>汽贸城列表</title>
<jsp:include page="../../import.jsp" flush="true" />
</head>

<script type="text/javascript">
	var grid = null;
	$(function () {
	    initForm();
		initGrid();//注意初始化要在initForm之后,因为在初始化grid的时候需要form参数
	    searchBtnEvent();
	});
	
	//初始化表单
	function initForm(){
		$("#searchBar").ligerForm();
	}
	//查询按钮事件
	function searchBtnEvent(){
		 $("#searchBtn").click(function(event) {
	         var form = new liger.get("searchBar");
	         var data = form.getData();
	         for (name in data){
	            grid.setParm(name,data[name]);
	         };
	        grid.reload();
	    });
	}
	
	//查询参数
	function getSearchParams(){
		var form = new liger.get("searchBar");
        var data = form.getData();
        return data;
	}
	
	//初始化列表
	function initGrid(){
		$("#ligergrid1").ligerGrid({
	    	url: '<%=path%>/product/splInfo/toAtcListPage.do',
	    	method : 'get',
	    	parms:getSearchParams(),
	        columns: [
	            { display: "汽贸城名称", name: 'atNm', minWidth: 150 , enabledSort:true},
	            { display: "汽贸城地址", name: 'atAddr', width: 80 , enabledSort:true},
	            { display: '联系人', name: 'rlNm', minWidth: 60 , enabledSort:true},
	            { display: '联系电话', name: 'mp', minWidth: 100 , enabledSort:true},
	            {
	                display: '操作',
	                isSort: false,
	                width: 100,
	                render: function (rowdata, rowindex, value){
	                    var h='<a class="sq-button-hasicon" href="javascript:chooseAtcRow(';
	                        h+="'"+rowdata.id+"',";
	                        h+="'"+rowdata.atNm+"'";
	                        h+=')"><i class="sqBtnIco_3"></i>选择</a>'
	                    return h;
	                }
	            }
	        ],
	        pageSize:10,
	        root:'rows',
	        record:'total',
	        hideLoadButton : true,
	        width: '100%',
	        height:'100%',
	        heightDiff:-2,
	        checkbox:false,
	        rownumbers:true
	    });
	    grid = liger.get("ligergrid1");
	    grid.setHeight(100);
	}
	
	function clearBtn(){
		var form = new liger.get("searchBar");
		form.clear();
	}
	
	function iframeResize () {
	    if (parent.mainApp) {
	        parent.mainApp.parentTab.onResize();
	    };
	}
	function chooseAtcRow(id,atNm){
		parent.window.document.getElementById("atcId").value=id;
		parent.window.document.getElementById("atcIdNm").value=atNm;
		parent.$.ligerDialog.close();
		parent.$(".l-dialog,.l-window-mask").css("display","none"); 
	}
</script>

<body class="iframeBody">
<div class="Wrapper">
<div class="searchArea">
    <form id="searchBar">
        <div class="fieldset1 clearFix">
            <div class="fieldBox">
                <div class="label">汽贸城名称</div>
                <div class="field">
                    <input name="atNm" id="atNm" type="text" class="ui-textbox" value="">
                </div>
            </div>
            <div class="clearFix"></div>
            <div class="btnsBox">
               <span id="searchBtn"  class="sq-button sq-button-round"><!-- <i class="sqBtnIco_1"></i> -->查询</span>
               <span id="clearBtn" class="sq-button sq-button-round"><!-- <i class="sqBtnIco_19"></i> -->清空</span>
            </div>
        </div>
        </form>
    </div>
</div>
<div id="ligergrid1" class="sq-grid"></div>
</div>
</body>
</html>